﻿#ifndef TOOLBARLENS_H
#define TOOLBARLENS_H

#include <QToolBar>
#include <QAction>
#include <QComboBox>
#include <QSettings>
#include <NosepieceCommon/LensManager.h>
#include "NosepieceCommon/NosepieceCommon_global.h"

namespace Qly
{

/**
 * @brief The ToolBarLens class 这个类只是物镜 GUI，不涉及具体的物镜转换操作。
 *                              对外表现就是一个下拉框。
 */
class NOSEPIECECOMMON_EXPORT ToolBarLens : public QToolBar
{
   Q_OBJECT
public:
    ToolBarLens(const QString &title, QWidget *parent = Q_NULLPTR);
    void loadItem(QStringList list);
    void loadSettings(QSettings &setting); //depri
    void loadFromLensManager(LensManager * lensData);
public slots:
    void setLensIndex(int n);
    void checkCalibLine() {m_actionClibLine->setChecked(true);}
    void setLens(int oldLens, int newLens) {Q_UNUSED(oldLens); setLensIndex(newLens);}
signals:
    void changeLens(int oldLens, int newLens);
    void showSettingsDialog();
    void calibMode(bool on);
private slots:
    void lensUpdate(int newlens);
private:

    void setupUi();
    QComboBox *m_comboBoxLens;
    QAction *m_actionSetup;
    QAction *m_actionClibLine;
    int m_old;

    LensManager *m_lens;
};

}//namespace
#endif // TOOLBARLENS_H
